<?php

class Vat_lieu_xay_dung extends Controller {

	function Vat_lieu_xay_dung(){
		parent::Controller();
		$this->common_model->checklogin();
		$this->load->model('vat_lieu_xay_dung_model');
	}		
	function index(){					
		$this->_loadview();
	}
	function addnew(){
		$this->vat_lieu_xay_dung_model->addnew();
		$this->_loadview_addnew();
	}
	function delete(){
		$this->vat_lieu_xay_dung_model->delete();
		$this->_loadview();
	}
	function update($id=''){
		$this->vat_lieu_xay_dung_model->update();
		$this->_loadview_update($id);
	}
	function _loadview(){		
		$data = $this->common_model->general();
		$data['bodyview'] = 'vat_lieu_xay_dung/list';	
		$data['datagrid'] = $this->vat_lieu_xay_dung_model->getdatasource();
		$this->load->view('mastertemplate',$data);
	}
	function _loadview_addnew(){
		$data = $this->common_model->general();
		$data['bodyview'] = 'vat_lieu_xay_dung/addnew';	
		$data['category'] = $this->vat_lieu_xay_dung_model->getcategorylist(0);
		$this->load->view('mastertemplate',$data);
	}
	function _loadview_update($id){
		$data = $this->common_model->general();
		$data['bodyview'] = 'vat_lieu_xay_dung/update';	
		$res = $this->vat_lieu_xay_dung_model->getdetail($id);
		if(FALSE===$res) redirect('vat_lieu_xay_dung','location');
		$data['detail'] = $res;
		$data['category'] = $this->vat_lieu_xay_dung_model->getcategorylist(0);
		$this->load->view('mastertemplate',$data);
	}
}

/* End of file */